home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.4 Patches 1998 April
/
IRIX 6.4 Recommended-Required Patches April 1998.img
/
dist
/
6.4_OCTANE
/
patchSG0002538.idb
/
usr
/
lib
/
desktop
/
togglexhost.z
/
togglexhost
Wrap
Text File
|
1997-12-08
|
3KB
|
86 lines
#!/bin/bsh
# Toggles xhost on or off (does "xhost +" or "xhost -")
# and posts an xconfirm as feedback after each operation.
# The xconfirm messages are in /usr/share/misc/sessionwarnings.
#
# Takes one argument: "+" or "-" indicating which operation
# to perform.
#
# Author: Rebecca Underwood
# Initial revision: 22 August 1996 for IRIX 6.3
#
if [ $# -ne 1 ]; then
exit 1
fi
if [ "$1" != "+" -a "$1" != "-" ]; then
exit 1
fi
# Note: If Xsession.dt changes where it gets its messages from,
# then you should change these next lines here too to keep
# all files in the same place. The next session is copied from
# Xsession.dt.
confirmdirectory=/usr/share/misc/sessionwarnings
# Set the user's language. Try to get correct locale in this
# order per Erik: First try desktopenv, second try $HOME/.lang,
# last try /etc/default/login, and as a last resort use C.
#
# 1) If $LANG is set, then Xsession.dt or ipanel has most likely
# put it in the environment.
if [ "$LANG" = "" ]; then
# 2) If LANG isn't set, try $HOME/.lang.
lang=$HOME/.lang
if [ -r $lang -a -f $lang ]
then
_lang=`cat $lang`
lconfirmdirectory=$confirmdirectory/$_lang
else
# 3) If no $HOME/.lang, try system default.
deflogin=/etc/default/login
if [ -r $deflogin -a -f $deflogin ]
then
_lang=`grep LANG= $deflogin|egrep -v \#|sed 's/LANG=//'`
lconfirmdirectory=$confirmdirectory/$_lang
else
# 4) Last resort.
lconfirmdirectory=$confirmdirectory/C
fi
fi
else
lconfirmdirectory=$confirmdirectory/$LANG
fi
# If $confirmdirectory/C is missing, then this can fail
# to post a message. It seems unlikely that it will
# be missing, though, because C is the default locale.
# (The alternative would be to hardcode a default message
# right into this script.)
#
if [ "$1" = "+" ]; then
/usr/bin/X11/xhost + > /dev/null
if [ -r $lconfirmdirectory/xhost.on.msg ]; then
xconfirm -b "`gettxt uxsgidesktop:736 'Continue'`" \
-file $lconfirmdirectory/xhost.on.msg -c > /dev/null
else
xconfirm -b "`gettxt uxsgidesktop:736 'Continue'`" \
-file $confirmdirectory/C/xhost.on.msg -c > /dev/null
fi
else
/usr/bin/X11/xhost - > /dev/null
if [ -r $lconfirmdirectory/xhost.off.msg ]; then
xconfirm -b "`gettxt uxsgidesktop:736 'Continue'`" \
-file $lconfirmdirectory/xhost.off.msg -c > /dev/null
else
xconfirm -b "`gettxt uxsgidesktop:736 'Continue'`" \
-file $confirmdirectory/C/xhost.off.msg -c > /dev/null
fi
fi
exit 0